import request from '@/utils/request'

// 根据工单编号查询头部信息
export function proWorkOrderlist(query = { workorderCode: 'MO000219' }) {
  return request({
    url: '/mes/pro/preparation/proWorkOrderlist',
    method: 'get',
    params: query
  })
}
// 查询头部信息
export function headerInfo(query) {
  return request({
    url: '/mes/pro/preparation/initHeader/settingInfo',
    method: 'get',
    params: query
  })
}


export function baseList(query) {
  return request({
    url: '/mes/pro/exception/mob/base/list',
    method: 'get',
    params: query
  })
}

export function proSop(query) {
  return request({
    url: '/mes/file/sop/excel',
    method: 'get',
    params: query
  })
}
export function versionList(query) {
  return request({
    url: '/mes/mobile/version/list',
    method: 'get',
    params: query
  })
}


// 上料防错
export function failsafeList(query) {
  return request({
    url: '/mes/mobile/failsafe/list' ,
    method: 'get',
    params: query
  })
}
// 上料防错
export function failsafeCheck(query) {
  return request({
    url: '/mes/mobile/failsafe/check' ,
    method: 'get',
    params: query
  })
}

//上料防错提交之后根据SN码查询信息接口   mes/mobile/failsafe/listItem
// export function getItemdata(query) {
//   return request({
//     url: '/mes/mobile/failsafe/listItem' ,
//     method: 'get', 
//     params: query
//   })
// }

// 上料防错报工接口
export function proFeedback(data) {
  return request({
    // url: '/mes/mobile/pro/feedback' ,
    url: '/mes/mobile/failsafe/finish' ,
    method: 'post',
    data: data
  })
}
// 移动端提交异常反馈信息
export function mobSubmit(data) {
  return request({
    url: '/mes/pro/exception/mob/submit',
    method: 'post',
    data: data
  })
}
// 开工前准备提交接口
export function preparation(data) {
  return request({
    url: '/mes/pro/preparation',
    method: 'post',
    data: data
  })
}

// 版本关连接口
export function pcbasoft(data) {
  return request({
    url: '/mes/mobile/pcbasoft',
    method: 'post',
    data: data
  })
}


// 上料防错需要物料的的 提交接口
export function failsafe(data) {
  return request({
    url: '/mes/mobile/failsafe',
    method: 'post',
    data: data
  })
}

//不用全物料的接口    
export function failsafeSubmitWork(data) {
  return request({
    url: '/mes/mobile/failsafe/addSubmitWork',
    method: 'post',
    data: data
  })
}

// 查询三码合一and铭牌模板
export function getYards(workorderCode) {
  return request({
    url: '/mes/mobile/pro/yards/' + workorderCode,
    method: 'get'
  })
}

// 物料解绑 sn列表查询
export function getRestructure(query) {
  return request({
    url: '/mes/mobile/restructure/list/',
    method: 'get',
    params: query
  })
}

// 物料解绑接口

export function unBundle(data) {
  return request({
    url: '/mes/mobile/restructure/unBundle',
    method: 'post',
    data: data
  })
}



// 工位自检 列表
export function getAlllist(query) {
  return request({
    url: '/mes/pro/self/inspection/alllist' ,
    method: 'get',
    params: query
  })
}
// 提交
export function getResult(data) {
  return request({
    url: '/mes/station/stationCheck/addStationCheckInfo',
    method: 'post',
    data: data
  })
}

// SN换绑
export function changeBinding(query) {
  return request({
    url: '/mes/mobile/restructure/displace' ,
    method: 'get',
    params: query
  })
}


export function addRepair(data) {
  return request({
    url: '/mes/pro/repair/addEquipmentRepair',
    method: 'post',
    data: data
  })
}

// 产线状态查询
export function listWorkorder(query) {
  return request({
    url: '/mes/pro/workorder/list',
    method: 'get',
    params: query
  })
}
// 产线状态查询--新
export function listWorkorder2(data) {
  return request({
    url: 'mes/pro/exception/mob/submit/checkStationStatus',
    method: 'post',
    data: data
  })
}
// 工位解锁
export function unLock(data) {
  return request({
    url: 'mes/pro/exception/mob/submit/unLock',
    method: 'post',
    data: data
  })
}

// 安规、灌流测试结果查询
export function regulationData(query) {
  return request({
    url: '/mes/datacol/debugging/PressureTest',
    method: 'get',
    params: query
  })
}

// 老化信息查询
export function agingInformationData(query) {
  return request({
    url: '/mes/datacol/debugging/burn',
    method: 'get',
    params: query
  })
}

// 调试信息查询
export function modeData(query) {
  return request({
    url: '/mes/datacol/debugging/debug',
    method: 'get',
    params: query
  })
}

// 根据SNCode查询SN码详细信息
export function getYardsBySnCode(snCode) {
  return request({
    url: '/mes/mobile/pro/yards/selectBySnCode/' + snCode,
    method: 'get'
  })
}

// 根据SNCode查询SN码详细信息
export function selectUnique(query) {
  return request({
    url: '/mes/mobile/pro/yards/selectUnique',
    method: 'get',
    params: query
  })
}

// 新增三码合一
export function addYardsInfo(data) {
  return request({
    url: '/mes/mobile/pro/yards/addInfo',
    method: 'post', 
    data: data
  })
} 

//添加暂停记录
export function addInfo(data) {
  return request({
    url: 'mes/suspend/add',
    method: 'post',
    data: data
  })
} 

//暂停开始 记录
export function finishInfo(data) {
  return request({
    url: 'mes/suspend/finish',
    method: 'post',
    data: data
  })
} 

// 查看缺料详情接口
export function getMaterialShortage(snCode) {
  return request({
    // url: `/mes/mobile/failsafe/getMaterialBySn/snCode=${snCode}`,
    url: `/mes/mobile/failsafe/getMaterialBySn/${snCode}`,
    method: 'get',
  })
}


// 工位自检查询接口
export function stationCheckDetails(data) {
  return request({
    // url: `/mes/mobile/failsafe/getMaterialBySn/snCode=${snCode}`,
    url: '/mes/station/stationCheck/details/getInfoBySnCode' ,
    method: 'post',
    data: data
  })
}

//调试工位 提交功能
export function submitDebugging(data) {
  return request({
    url: 'mes/debugging/work',
    method: 'post',
    data: data
  })
} 

//调试工位 根据sn码查询功能
export function getDebugging(query) {
  return request({
    url: 'mes/debugging/work/getsncode',
    method: 'get',
    params: query
  })
} 

//序列号替换 根据sn码查询功能
export function getSerialReplace(query) {
  return request({
    url: 'mes/mobile/failsafe/getList/material',
    method: 'get',
    params: query
  })
} 

//序列号替换 提交功能
export function submitSerialReplace(data) {
  return request({
    url: 'mes/wm/issueline/material',
    method: 'put',
    data: data
  })
}

// 查询部门列表
export function listDept(query) {
  return request({
    url: '/system/dept/list',
    method: 'get',
    params: query
  })
}

//跳过接口  
export function skipstep(data) {
  return request({
    url: 'mes/mobile/failsafe/skipstep',
    method: 'post',
    data: data
  })
}

// ipqc全检查询
export function getSubmitIpqc(query) {
  return request({
    url: '/mes/qc/qcLineRejectRecords/getSubmitInfo',
    method: 'get',
   params: query
  })
}
// ipqc全检提交
export function addSubmitLineInfo(data) {
  return request({
    url: '/mes/qc/qcLineRejectRecords/addSubmitLineInfo',
    method: 'post',
    data: data
  })
}
// 获取报工时间
export function getStartReporting(data) {
  return request({
    url: '/mes/mobile/failsafe/getStartReporting',
    method: 'post',
    data: data
  })
}